<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    canvas{
      background-color: aqua;
    }
  </style>
</head>
<body>
  <canvas></canvas>
  <script>
    var canvas=document.querySelector("canvas")
    var ctx=canvas.getContext("2d")
    canvas.width=window.innerWidth
    canvas.height=window.innerHeight
    var x=50
    var y=50
    function qou(){
      x++
      y++
    ctx.beginPath()
    // ctx.clearRect(0,0,canvas.width,canvas.height)
    // clearInterval()
    ctx.save()
    ctx.fillStyle="red"
    ctx.arc(x,y,10,0,Math.PI*2)
    ctx.fill()
    ctx.restore()
    ctx.closePath()
    ctx.fillStyle="rgba(0,0,0,.1)"
    ctx.fillRect(0,0,canvas.width,canvas.height)
    ctx.closePath()
    requestAnimationFrame(qou)
    }
    qou()
  </script>
</body>
</html>